const defaultState = {
    columns: [],
    data: [],
    visible: false
};
export default function columns(state = defaultState, action) {
    const {type, payload} = action;
    switch (type) {
        case 'ZAD_ORDER_RECEIVABLE.GET_COLUMNS':
            const data = [];
            payload.forEach(item => {
                const text = item.toString();
                data.push(text);
            });
            return {...state, data: [...data]};
        case 'ZAD_ORDER_RECEIVABLE.HIDE_COLUMNS':
            return {...state, visible: false, data: []};
        case 'ZAD_ORDER_RECEIVABLE.SHOW_COLUMNS':
            return {...state, visible: true};
        default:
            return state;
    }
}

